Skip to content

bugfix(audiomanager): Fix dummy audio manager implementation for failing audio length script conditions in headless mode#2313

Open
Caball009 wants to merge 5 commits intoTheSuperHackers:mainfrom
Caball009:fix_dummy_audio_manager
Open

bugfix(audiomanager): Fix dummy audio manager implementation for failing audio length script conditions in headless mode#2313
Caball009 wants to merge 5 commits intoTheSuperHackers:mainfrom
Caball009:fix_dummy_audio_manager

Conversation

@Caball009
Copy link

@Caball009 Caball009 commented Feb 16, 2026

Our current implementation of dummy audio manager is incomplete, because it cannot return the actual length of audio files. Replays will mismatch if they contain scripts that rely on this.

TODO:

  • Make sure the Github CI can access the audio files.
  • Replicate in Generals.

@Caball009 Caball009 added Audio Is audio related Bug Something is not working right, typically is user facing Major Severity: Minor < Major < Critical < Blocker ThisProject The issue was introduced by this project, or this task is specific to this project Script Is related to Script Engine, SCB labels Feb 16, 2026
@Caball009 Caball009 changed the title bugfix(audiomanager): Fix audio manager implementation for failing script conditions in headless mode bugfix(audiomanager): Fix dummy audio manager implementation for failing script audio length conditions in headless mode Feb 16, 2026
@Caball009 Caball009 changed the title bugfix(audiomanager): Fix dummy audio manager implementation for failing script audio length conditions in headless mode bugfix(audiomanager): Fix dummy audio manager implementation for failing audio length script conditions in headless mode Feb 16, 2026
@Caball009 Caball009 force-pushed the fix_dummy_audio_manager branch from 7751f9e to 477d80b Compare February 28, 2026 16:19
@Caball009 Caball009 marked this pull request as ready for review February 28, 2026 16:21
@greptile-apps
Copy link

greptile-apps bot commented Feb 28, 2026

Greptile Summary

This PR fixes headless-mode replay CRC mismatches caused by scripts that rely on the actual length of audio files. The root cause was that the old AudioManagerDummy (in GameAudio.h) always returned -1 from getFileLengthMS, whereas a normal session would return the real duration via the Miles Sound System. The fix replaces AudioManagerDummy with a new MilesAudioManagerDummy that inherits from MilesAudioManager instead of the base AudioManager; by intentionally not overriding openDevice(), closeDevice(), or getFileLengthMS(), the parent Miles implementation is used to open the audio driver and query actual file lengths, while all playback-related methods remain no-ops. The factory methods createAudioManager and createRadar are refactored to accept a Bool dummy parameter — consistent with the pre-existing createParticleSystemManager(Bool dummy) pattern — and the inline construction logic is moved into the factories, simplifying GameEngine::init() in both Generals/ and GeneralsMD/.\n\nKey changes:\n- AudioManagerDummy removed from Core/GameEngine/Include/Common/GameAudio.h\n- New MilesAudioManagerDummy added to Core/GameEngineDevice/Include/MilesAudioDevice/MilesAudioManager.h, inheriting from MilesAudioManager to enable real getFileLengthMS() behaviour\n- createAudioManager(Bool dummy) and createRadar(Bool dummy) signatures updated across both Generals/ and GeneralsMD/ headers and implementations\n- GameEngine::init() simplified in both games — headless-mode branching delegated to factory methods

Confidence Score: 5/5

Safe to merge — the fix is complete for both Generals and GeneralsMD, and previously raised concerns have been resolved or accepted by the team.

No P0 or P1 findings remain. Prior review concerns about openDevice()/m_audioOn and the Generals build were resolved through team discussion and are now addressed in the code. The factory-method refactor is clean and consistent with the existing createParticleSystemManager(Bool dummy) pattern. The open TODO about CI audio-file access is an operational concern acknowledged by the author and does not affect code correctness.

No files require special attention.

Important Files Changed

Filename Overview
Core/GameEngine/Include/Common/GameAudio.h Removes the old AudioManagerDummy class (which returned -1 for getFileLengthMS), replacing it with the new MilesAudioManagerDummy in MilesAudioManager.h.
Core/GameEngineDevice/Include/MilesAudioDevice/MilesAudioManager.h Introduces MilesAudioManagerDummy, which inherits from MilesAudioManager rather than the base AudioManager, so the parent's openDevice() and getFileLengthMS() are used to return real audio durations in headless mode.
Generals/Code/GameEngine/Source/Common/GameEngine.cpp Simplifies headless-mode instantiation — inline ternary moved into factory methods; createAudioManager(m_headless) and createRadar(m_headless) replace manual NEW AudioManagerDummy/NEW RadarDummy expressions.
Generals/Code/GameEngineDevice/Include/Win32Device/Common/Win32GameEngine.h Implements createRadar(Bool dummy) and createAudioManager(Bool dummy) inline, returning the appropriate real or dummy subsystem; mirrors the pattern already used for createParticleSystemManager.
GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp Same refactoring as the Generals GameEngine.cpp — factory calls updated to pass m_headless flag, removing inline ternary allocation logic from init().
GeneralsMD/Code/GameEngineDevice/Include/Win32Device/Common/Win32GameEngine.h Mirrors the Generals Win32GameEngine.h changes — factory inline implementations updated with Bool dummy parameter and MilesAudioManagerDummy dispatch.

Reviews (6): Last reviewed commit: "Merge branch 'main' into fix_dummy_audio..." | Re-trigger Greptile

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 files reviewed, 6 comments

Edit Code Review Agent Settings | Greptile

@Caball009
Copy link
Author

Addressed feedback.

@Caball009 Caball009 force-pushed the fix_dummy_audio_manager branch from 9432bea to c439704 Compare March 26, 2026 16:21
@Caball009
Copy link
Author

Replicated in Generals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Audio Is audio related Bug Something is not working right, typically is user facing Major Severity: Minor < Major < Critical < Blocker Script Is related to Script Engine, SCB ThisProject The issue was introduced by this project, or this task is specific to this project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incomplete implementation of dummy audio manager can cause mismatches in headless mode

2 participants